package com.awenhui.demo.model;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import org.hibernate.validator.constraints.URL;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.*;
import java.util.Date;

/**
 * @author yuxf
 * @version 1.0
 * @date 2020/7/20 16:37
 */
public class ValidModel {


    @NotBlank(message = "姓名不能为空",groups = {})
    @Pattern(regexp = "^1[34578]\\d{9}$", message = "手机号码格式不正确")
    private String name;
    @Future
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    public Date birth;

    public Date getBirth() {
        return birth;
    }

    public void setBirth(Date birth) {
        this.birth = birth;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Min(10)
    @Max(20)
    @Range(min = 10, max = 20)
    private int age;
}
